var App = {};
App.eventHandler = '';
App.navigate = '';

var Globals = {};

Globals.CurrentLanguage = 'es';

Globals.Languages = {
	'es': true,
	'en': false,
	'pr': false
};

Globals.SetCurrentLanguage = function(){
	for (var x in Globals.Languages) {
		if (Globals.Languages[x] == true) {
			Globals.CurrentLanguage = x;
		}
	}
}();

Globals.Provinces = [{
	id: 1,
	value: 'Buenos Aires'
},{
	id: 2,
	value: 'Catamarca'
},{
	id: 3,
	value: 'Chaco'
},{
	id: 4,
	value: 'Chubut'
},{
	id: 5,
	value: 'Córdoba'
},{
	id: 6,
	value: 'Corrientes'
},{
	id: 7,
	value: 'Entre Ríos'
},{
	id: 8,
	value: 'Formosa'
},{
	id: 9,
	value: 'Jujuy'
},{
	id: 10,
	value: 'La Pampa'
},{
	id: 11,
	value: 'La Rioja'
},{
	id: 12,
	value: 'Mendoza'
},{
	id: 13,
	value: 'Misiones'
},{
	id: 14,
	value: 'Neuquén'
},{
	id: 15,
	value: 'Río Negro'
},{
	id: 16,
	value: 'Salta'
},{
	id: 17,
	value: 'San Juan'
},{
	id: 18,
	value: 'San Luis'
},{
	id: 19,
	value: 'Santa Cruz'
},{
	id: 20,
	value: 'Santa Fe'
},{
	id: 21,
	value: 'Santiago del Estero'
},{
	id: 22,
	value: 'Tierra del Fuego'
},{
	id: 23,
	value: 'Tucumán'
}];

Globals.Regions = [{
	id: 1,
	lang: [{
		'value': 'Noroeste',
		'id': 'es'
	}, {
		'value': 'Northwest',
		'id': 'en'
	},{
		'value': 'Noroeste',
		'id': 'pt'
	}]
},{
	id: 2,
	lang: [{
		'value': 'Noreste',
		'id': 'es'
	}, {
		'value': 'Northeast',
		'id': 'en'
	},{
		'value': 'Nordeste',
		'id': 'pt'
	}]
},{
	id: 3,
	lang: [{
		'value': 'Centro',
		'id': 'es'
	}, {
		'value': 'Central',
		'id': 'en'
	},{
		'value': 'Central',
		'id': 'pt'
	}]
},{
	id: 4,
	lang: [{
		'value': 'Patagonia',
		'id': 'es'
	}, {
		'value': 'Patagonia',
		'id': 'en'
	},{
		'value': 'Patagônia',
		'id': 'pt'
	}]
}];

Globals.Categories = [{
	id: 1,
	lang: [{
		'value': 'Parque Nacional',
		'id': 'es'
	}, {
		'value': 'National Park',
		'id': 'en'
	},{
		'value': 'Parque Nacional',
		'id': 'pt'
	}]
},{
	id: 2,
	lang: [{
		'value': 'Reserva Natural',
		'id': 'es'
	}, {
		'value': 'Nature Reserve',
		'id': 'en'
	},{
		'value': 'Reserva Natural',
		'id': 'pt'
	}]
},{
	id: 3,
	lang: [{
		'value': 'Monumento Natural',
		'id': 'es'
	}, {
		'value': 'Natural Heritage',
		'id': 'en'
	},{
		'value': 'Patrimônio Natural',
		'id': 'pt'
	}]
}];

Globals.GetCategoryName = function(id){
	var names = Globals.Categories;

	for (var x = 0, l = names.length; x < l; x++) {
		if (names[x].id == id) {
			for (var a = 0, b = names[x].length; a < b; a++) {
				if (names[x].lang[a].id == Globals.CurrentLanguage) {
					return names[x].lang[a].value;
				}
			}
		}
	}
};

Globals.fixedPolyfill = function(id) {
	var el = document.getElementById(id),
	height = el.clientHeight,
	parentNode = el.parentNode;

	window.onscroll = function() {

		if (window.pageYOffset >= el.offsetTop){
			parentNode.style.marginBottom = height + 'px';
			el.style.position = 'absolute';
			el.style.top = (window.pageYOffset-1) + 'px';
		} else {
			parentNode.style.marginBottom = '5px';
			el.style.position = 'relative';
			el.style.top = '0px';
		}
	};
};